import type { ApiPagination, ApiPaginationParams } from '#types/utils'
import { requestClient } from '../request'
import type {
    creatorSuggestionItemForm,
    creatorSuggestionPageListItem
} from './model/creatorSuggestionModel'

// 创作者建议
export default class CreatorSuggestionApi {
    static get inst() {
        return (
            CreatorSuggestionApi._inst || (CreatorSuggestionApi._inst = new CreatorSuggestionApi())
        )
    }
    private static _inst: CreatorSuggestionApi
    add(params: Partial<creatorSuggestionItemForm>) {
        return requestClient.post<null>('/customerServiceApply/add', params)
    }
    details(ids: Array<number | string>) {
        return requestClient.get<null>(`/customerServiceApply/details/${ids}`)
    }
    /**
     * 分页
     * @param params
     */
    getPageList(params: ApiPaginationParams<{ username?: string }>) {
        return requestClient.get<ApiPagination<creatorSuggestionPageListItem>>(
            '/customerServiceApply/list',
            {
                params
            }
        )
    }
    reply(params: Partial<creatorSuggestionItemForm>) {
        return requestClient.post<null>('/customerServiceApply/reply', params)
    }
}
